home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Sound / AlgoMusic / Developer / Example.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-12-02  |  1.4 KB  |  48 lines

  1. /* 
  2.  
  3.    Example.c    (C) 1997 by Thomas Schürger
  4.  
  5.    This is a small example how to use the AlgoMusicMsgPort structure
  6.    in order to obtain playing information from AlgoMusic.
  7.  
  8.    Have a look at "AlgoMusic.h". You should get the idea.
  9.  
  10.    The way the port data is accessed here is not the way one should
  11.    do it, "AlgoMusic.h" will give you information about that.
  12.  
  13. */
  14.  
  15. #include <proto/exec.h>
  16. #include <pragmas/exec_pragmas.h>
  17. #include <stdio.h>
  18.  
  19. #include "algomusic.h"
  20.  
  21. main()
  22.   {
  23.     struct AlgoMusicMsgPort *amport;
  24.  
  25.     if(amport=(struct AlgoMusicMsgPort *)FindPort(ALGOMUSICPORTNAME))
  26.       {
  27.       printf("       Songname: %s\n",amport->SongName);
  28.       printf("     Randominit: $%08lx\n",amport->RandomInit);
  29.       printf("       Song Nr.: %lu\n",amport->SongNr);
  30.       printf("            BPM: %lu\n",amport->BPM);
  31.       printf("       Finetune: %ld\n",amport->FineTune);
  32.       printf(" Total Patterns: %lu\n",amport->TotalSteps/64);
  33.       printf("Current Pattern: %lu\n",amport->CurrentStep/64+1);
  34.       printf("       Progress: %lu %%\n",amport->Progress);
  35.  
  36.       printf("          State: ");
  37.       switch(amport->State)
  38.         {
  39.         case STATE_UNKNOWN:   printf("STATE_UNKNOWN\n");break;
  40.         case STATE_RENDERING: printf("STATE_RENDERING\n");break;
  41.         case STATE_PLAYING:   printf("STATE_PLAYING\n");break;
  42.         case STATE_STOPPED:   printf("STATE_STOPPED\n");break;
  43.         }
  44.       }
  45.     else
  46.       printf("AlgoMusic is not running!\n");
  47.   }
  48.